package qc.module.platform.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import qc.module.platform.dto.file.FileInfoDto;
import qc.module.platform.entity.QcFiles;

import java.util.List;

/**
 * FileMapper
 *
 * @author QuCheng Tech
 * @since 2023/8/14
 */
@Mapper
public interface FileMapper {
    FileMapper MAPPER = Mappers.getMapper(FileMapper.class);

    @Mapping(target = "type", source = "type.index")
    @Mapping(target = "tm", source = "tm", dateFormat = "yyyy-MM-dd")
    @Mapping(target = "path", source = "path")
    FileInfoDto toDto(QcFiles en);

    List<FileInfoDto> toDtoList(List<QcFiles> list);
}
